#include "sylar/tcp_server.cc"
#include "sylar/iomanager.h"
#include "sylar/log.h"
static sylar::Logger::ptr g_logger = SYLAR_LOG_ROOT();

void run(){
	auto addr = sylar::IPAddress::LookupAny("0.0.0.0:801");
	auto addr2 = sylar::UnixAddress::ptr(new sylar::UnixAddress("/tmp/unix_addr"));
	// SYLAR_LOG_INFO(g_logger) << *addr << " - " << *addr2;
	std::vector<sylar::Address::ptr> addrs;
	addrs.push_back(addr);
	addrs.push_back(addr2);

	sylar::TcpServer::ptr tcp_server(new sylar::TcpServer);
	std::vector<sylar::Address::ptr> fails;
	if(!tcp_server->bind(addrs, fails)){
		// SYLAR_LOG_ERROR(g_logger) << "failed";
		sleep(2);
	}
	tcp_server->start();
}

int main()
{
	sylar::IOManager iom(2);
	iom.schedule(run);


	return 0;
}